/****************************************************************************
 * Copyright (c) 2010 Torkild U. Resheim
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Torkild U. Resheim  - initial API and implementation
 *****************************************************************************/
package no.resheim.buildmonitor.ui.views.commands.log;

import java.text.MessageFormat;

import no.resheim.buildmonitor.core.data.Job;
import no.resheim.buildmonitor.ui.log.LogCompareInput;
import no.resheim.buildmonitor.ui.views.commands.AbstractCommandHandler;

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareUI;

public abstract class AbstractCompareHandler extends AbstractCommandHandler {

	protected void compare(Job job, int left, int right) {
		CompareConfiguration configuration = new CompareConfiguration();
		LogCompareInput input = new LogCompareInput(configuration, job, left,
				right);
		input.setTitle(MessageFormat.format(
				"Comparing {0}, build #{1} with #{2}",
				new Object[] { job.getName(), left, right }));
		CompareUI.openCompareEditor(input, true);
	}

}
